feat(neo4j): import/export bindings, parameters_json and unresolved config reads (#182) - #183
Merged
Merged
Conversation
…onfig reads reach the graph (#182) resolved_module on TSImport/TSExport (ts.resolveModuleName at build time, per-project resolution cache); TS_IMPORTS / TS_RE_EXPORTS aggregated per (module, target) with spellings/names/aliases/type_only_names; exports_json on :TSModule; parameters_json on :TSCallable; TS_READS_CONFIG_UNRESOLVED app -> ghost/callee keyed key|reason. Contract stays 2.0.0 (additive). export { type X } per-specifier flags now honoured.
… review follow-ups (#182) Moves resolution out of the builder into syntactic_analysis/moduleResolution.ts, re-stamped every run (tsconfig paths and target existence are state the content-hash cache cannot see). Folds prov across collapsed unresolved-read sites; the accounting test enumerates the new ghost sources; the bolt-writer absent->present ceiling is recorded in the spec.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #182. Spec:
docs/design/specs/neo4j-bindings-parameters-config.md(decisions D1–D6, mirrored in.claude/SCHEMA_DECISIONS.md). Additive on Neo4j contract 2.0.0; ships in 1.4.0.What changes
analysis.jsonTSImport.resolved_module— the compiler's answer (ts.resolveModuleName, tsconfigpaths, directory index,.js→.ts), absent for externals/builtins/unresolvable; a per-run stamp over cached modules too (syntactic_analysis/moduleResolution.ts), since tsconfig and target existence are state the content-hash cache cannot seeTS_IMPORTS:TSModule → :TSModule | :TSExternal, ONE per (module, target):spellings[],imported_names[],aliases[],type_only_names[]; externals on the@external/<package root>ghostTS_PROVIDES/TS_UNRESOLVED_IMPORTalready address; unresolved relative spellings dropped (python's rule)TSExport.resolved_moduleon re-exports;export { type X }per-specifier flag now honouredTS_RE_EXPORTSaggregated like imports (exported_names[],"*"for star);exports_jsonon:TSModule(verbatim list, absent when empty)parameters_jsonon:TSCallable, python's encoding (verbatim list, absent when empty). Measured 430 KB = 1.4 % ofgraph.cypheron cants selfTS_READS_CONFIG_UNRESOLVED:TSApplication → :TSExternal | :TSCallable,key/reason/prov,_k = key|reason, nosite(python's documented per-site collapse)Corrects the issue as filed:
TS_USES_CONFIGwas already projected; only the unresolved counterpart was missing.Why
ts.resolveModuleNameand not ts-morph'sgetModuleSpecifierSourceFile()The ts-morph route goes through the module symbol, which a side-effect-imported script with no import/export of its own never has —
import "./polyfill"came back unresolved. The compiler resolver answers every specifier the way tsc does. OneModuleResolutionCacheper project.Incremental Bolt ceiling (recorded in the spec)
A binding edge's presence depends on the target existing, so an edge that flips absent → present while the importer is byte-identical (target file added, shard widened) is computed but filtered by the changed-owner rule and not written until the importer changes or the push is
--eager. Same class asTS_CALLS; the removal direction is covered by the container test.Tests
test/neo4j-bindings.test.ts(new): a cache-persistence case (target added later,pathsedited, target removed — importer cached throughout); a temp project withpathsalias, directory index,.js→.ts, side-effect,import type/{ type X }, external, builtin, missing relative, star/named/aliased/type-only re-exports, localexport { x as y }; parameters incl. optional/rest; unresolved reads onartifacts-appwith the_krule.test/schema-v2.test.ts: the exhaustive edge-accounting gate learns the three aggregated families (distinct-pair / distinct-triple counts restated from JSON).test/neo4j-bolt.test.ts(container, ran locally, 6 pass): edges land live; a staleTS_IMPORTSedge to a vanished target survives a default push and goes with the target under--eager.schema.neo4j.jsonregenerated; conformance green.bun test: 325 pass.Propagation
get_imports/get_exports/get_method_parameters/get_config_readerscan answer; pin moves to the release carrying this.reconstruct.callable_already decodesparameters_json.JAVA_READS_CONFIG_UNRESOLVEDwith_k = key|reason(comment posted). Java already hasJ_IMPORTSandparameters_json.